<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

use app\common\model\ExchangeTags;


/**
 * 平台控制器
 */
class MarketPlatform extends AdminBase
{
    
    /**
     * 平台列表
     */
    public function platformList()
    {
        
       // $where = $this->logicPlatform->getWhere($this->param);

        $this->assign('list', $this->logicPlatform->getPlatformList($this->param, 'a.*', 'a.create_time desc'));
        $this->assign('tags', ExchangeTags::all(['status'=>1]));
        $this->assign('param', $this->param);
        return $this->fetch('platform_list');
    }


   


    /**
     * 平台添加
     */
    public function platformAdd()
    {
        
        $this->platformCommon();

        return $this->fetch('platform_edit');
    }
    
    /**
     * 平台编辑
     */
    public function platformEdit()
    {
        
        $this->platformCommon();
        
        $info = $this->logicPlatform->getplatformInfo(['a.id' => $this->param['id']], 'a.*');

        
        $this->assign('info', $info);
        $this->assign('tags', ExchangeTags::all(['status'=>1]));
        return $this->fetch('platform_edit');
    }
    
    /**
     * 平台添加与编辑通用方法
     */
    public function platformCommon()
    {
        
//      IS_POST && $this->jump($this->logicPlatform->platformEdit($this->param));
        IS_POST && $this->jump($this->logicPlatform->platformEdit($_POST));
        $this->assign('tags', ExchangeTags::all(['status'=>1]));
    }
    


    

    
    /**
     * 数据状态设置
     */
    public function setStatus()
    {
        
        $this->jump($this->logicAdminBase->setStatus('ExchangePlatform', $this->param));
    }

    /**
     * 数据状态设置
     */
    public function update_info()
    {

        $this->jump($this->logicPlatform->update_info( $this->param));
    }


    /**
     * 隐藏/显示回帖
     */
    public function comment_update_info()
    {

        $this->jump($this->logicPlatform->comment_update_info( $this->param));
    }


    /**
     * 平台标签添加
     */
    public function platformTagsAdd()
    {

        IS_POST && $this->jump($this->logicPlatform->platformTagsEdit($this->param));

        return $this->fetch('platform_Tags_edit');
    }

    /**
     * 平台标签编辑
     */
    public function platformTagsEdit()
    {

        IS_POST && $this->jump($this->logicPlatform->platformTagsEdit($this->param));

        $info = $this->logicPlatform->getplatformTagsInfo(['id' => $this->param['id']]);

        $this->assign('info', $info);

        return $this->fetch('platform_tags_edit');
    }

    /**
     * 平台标签列表
     */
    public function platformTagsList()
    {

        $this->assign('list', $this->logicPlatform->getplatformTagsList());

        return $this->fetch('platform_tags_list');
    }

    /**
     * 平台标签删除
     */
    public function platformTagsDel($id = 0)
    {

        $this->jump($this->logicPlatform->platformTagsDel(['id' => $id]));
    }
}
